package com.study.thisdemo;

public class Animal {
    String name;
    int age;

    public Animal() {
        System.out.println("无参数构造器中的this"+this
        );
    }

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("有参数构造器中的this"+this
        );
    }
    public void run(){
        System.out.println("方法中的this"+this
        );
    }

    public void goWith(String name){
        System.out.println(this.name+"正在和"+name+"比赛");
    }
}
